import axios from "axios";

self.addEventListener("message", async (e) => {
    const frameData = e.data.frameData;
    const token = e.data.editorToken;
    let params = { frameData, token };
    let res = await axios({
        url: "/api/get",
        method: "get",
        params: params,
    })
    if (res.data.code !== 0) {
        // worker线程发送消息
        (self as any).postMessage({
            error: true,
        });
        return;
    }
    // worker线程发送消息
    (self as any).postMessage({
        error: false,
        data: res.data.data
    });
});

export { };
